A pitch detection algorithm (PDA) is an algorithm designed to estimate the pitch or fundamental frequency of a quasiperiodic or virtually periodic signal, usually a digital recording of speech or a musical note or tone. This can be done in the time domain or the frequency domain.
PDAs are used in various contexts (e.g. phonetics, music information retrieval, speech coding, musical performance systems) and so there may be different demands placed upon the algorithm. There is as yet no single ideal PDA, so a variety of algorithms exist, most falling broadly into the classes given below.[1]
Contents |
In the time domain, a PDA typically estimates the period of the quasiperiodic signal, then inverts that value to give the frequency.
One simple approach would be to measure the distance between zero crossing points of the signal (i.e. the Zero-crossing rate). However, this does not work well with complex waveforms which are composed of multiple sine waves with differing periods. Nevertheless, there are cases in which zero-crossing can be a useful measure, for example in some speech applications where a single source is assumed. The algorithm's simplicity makes it "cheap" to implement.
More sophisticated approaches compare segments of the signal with other segments offset by a trial period to find a match. AMDF (average magnitude difference function), ASMDF (Average Squared Mean Difference Function), and other similar autocorrelation algorithms work this way. These algorithms can give quite accurate results for highly periodic signals. However, they have false detection problems (often "octave errors"), can sometimes cope badly with noisy signals (depending on the implementation) and - in their basic implementations - do not deal well with polyphonic sounds (which involve multiple musical notes of different pitches).
Current time-domain pitch detector algorithms tend to build upon the basic methods referred to above, with additional refinements to bring the performance more in line with a human assessment of pitch. For example, the YIN algorithm[2] and the MPM algorithm[3] are both based upon autocorrelation.
In the frequency domain, polyphonic detection is possible, usually utilizing the Fast Fourier Transform (FFT) to convert the signal to a frequency spectrum. This requires more processing power as the desired accuracy increases, although the well-known efficiency of the FFT algorithm makes it suitably efficient for many purposes.
Popular frequency domain algorithms include: the harmonic product spectrum;[4][5] cepstral analysis[6] and maximum likelihood which attempts to match the frequency domain characteristics to pre-defined frequency maps (useful for detecting pitch of fixed tuning instruments); and the detection of peaks due to harmonic series.[7]
To improve on the pitch estimate derived from the discrete Fourier spectrum, techniques such as spectral reassignment (phase based) or Grandke interpolation (magnitude based) can be used to go beyond the precision provided by the FFT analysis.
The fundamental frequency of speech can vary from 40 Hz for low-pitched male voices to 600 Hz for children or high-pitched female voices.[8]
Autocorrelation methods need at least two pitch periods to detect pitch. To detect a fundamental frequency of 40 Hz this means that at least 50 milliseconds (ms) of the speech signal must be analyzed. However, during 50 ms, speech with higher fundamental frequencies may not necessarily have the same fundamental frequency throughout the window.[8]
7. M. A. Ben Messaoud, A. Bouzid, et N. Ellouze, A New method for pitch estimation and voicing decision based on spectral multi-scale product analysis. Publié dans Signal Processing: An International Journal, Vol. 3(5), Septembre 2009. [1]
8. M. A. Ben Messaoud, A. Bouzid, et N. Ellouze, Spectral Multi-scale Product Analysis for Pitch Estimation from Noisy Speech Signal. Revised selected papers NOLISP’09, LNAI 5933, J. Solé-Casals et V. Zaiats (Eds.), Springer -Verlag Berlin Heidelberg, pp. 95–102, Février 2010. [2]
9. Roudra Chakraborty, Debapriya Sengupta and Sagnik Sinha. Pitch Tracking of Acoustic Signals based on Average Squared Mean Difference Function. Signal, Image and Video Processing, Springer London. DOI: 10.1007/s11760-008-0072-5 [3]